/**
 * Get non-undefined value with default values.
 * @param val raw value, can be undefined
 * @param defaultValue default value
 * @return the raw value if it is not undefined, the default value otherwise
 */
function getValueOrDefault<T>(val: T | undefined, defaultValue: T): T {
  return val === undefined ? defaultValue : val;
}

// Type utils in TypeHelper module.
export { getValueOrDefault };